package com.example.tomatotodo.model;

import com.example.tomatotodo.util.ColorUtils;

import java.io.Serializable;
import java.util.UUID;

import lombok.Getter;

@Getter
public class TodoItem implements Serializable {
    private static final long serialVersionUID = 1L;

    private final String id;                    // 添加唯一标识符
    private final TodoSettingDTO setting;
    private final int color;
    private boolean completed;

    public TodoItem(TodoSettingDTO setting) {
        this.id = UUID.randomUUID().toString(); // 生成唯一ID
        this.setting = setting;
        this.color = ColorUtils.generateRandomPastelColor();
        this.completed = false;
    }

    public TodoItem(TodoSettingDTO setting, int color) {
        this.id = UUID.randomUUID().toString(); // 生成唯一ID
        this.setting = setting;
        this.color = color;
        this.completed = false;
    }

    public String getName() {
        return setting.getTitle();
    }

    public String getType() {
        return setting.getType();
    }

    public Integer getCountdownDuration() {
        return setting.getCountdownDuration();
    }
}
